home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-08-26 | 47.7 KB | 1,647 lines |
- Path: uunet!cs.utexas.edu!sun-barr!cronkite.Central.Sun.COM!exodus!soliado.East.Sun.COM
- From: sdo@soliado.East.Sun.COM (Scott Oaks - Sun Consulting NYC)
- Newsgroups: comp.sources.x
- Subject: v14i009: olvwm - Open Look Virtual Window Manager, Patch2, Part03/03
- Message-ID: <19075@exodus.Eng.Sun.COM>
- Date: 27 Aug 91 06:00:48 GMT
- References: <csx-14i007-olvwm@uunet.UU.NET>
- Sender: news@exodus.Eng.Sun.COM
- Lines: 1635
- Approved: argv@sun.com
-
- Submitted-by: sdo@soliado.East.Sun.COM (Scott Oaks - Sun Consulting NYC)
- Posting-number: Volume 14, Issue 9
- Archive-name: olvwm/patch2.03
- Patch-To: olvwm: Volume 12, Issues 57-72
- Patch-To: olvwm: Volume 14, Issues 6
-
- *** build/virtual.c Sat Jun 22 20:09:31 1991
- --- src/virtual.c Sat Jun 22 20:56:20 1991
- ***************
- *** 12,19 ****
- #include "defaults.h"
- #include "resources.h"
- #include "st.h"
-
- ! static char sccsid[] = "@(#)virtual.c 1.3 olvwm version 4/17/91";
-
- #define TRUE (1)
- #define FALSE (0)
- --- 12,22 ----
- #include "defaults.h"
- #include "resources.h"
- #include "st.h"
- + #include "menu.h"
- + #include "list.h"
- + #include "patchlevel.h"
-
- ! static char sccsid[] = "@(#)virtual.c 1.4 olvwm version 6/22/91";
-
- #define TRUE (1)
- #define FALSE (0)
- ***************
- *** 36,69 ****
- int VDMWidth, VDMHeight;
- int VDMOutlineX, VDMOutlineY;
- int VDMOutlineWidth, VDMOutlineHeight;
- extern long WorkspaceColorPixel;
-
- int VirtualBackgroundColorSet = FALSE;
- int VirtualForegroundColorSet = FALSE;
- int VirtualFontColorSet = FALSE;
-
- extern GC RootGC;
- static GC VDMGC = NULL;
-
- MakeVirtualDesktop(dpy)
- Display *dpy;
-
- {
- int width, height;
-
- sscanf(GRV.VirtualDesktop, "%dx%d", &width, &height);
- ! if (width < DisplayWidth(dpy,DefaultScreen(dpy)))
- ! width = width * DisplayWidth(dpy,DefaultScreen(dpy));
- ! if (height < DisplayHeight(dpy,DefaultScreen(dpy)))
- ! height = height * DisplayHeight(dpy,DefaultScreen(dpy));
-
- ! VirtualDesktopWidth = width;
- ! VirtualDesktopHeight = height;
- VirtualDesktopX = 0;
- VirtualDesktopY = 0;
- VirtualContext = XUniqueContext();
- }
-
- MakeVDM(dpy)
- Display *dpy;
-
- --- 39,163 ----
- int VDMWidth, VDMHeight;
- int VDMOutlineX, VDMOutlineY;
- int VDMOutlineWidth, VDMOutlineHeight;
- + int VDMRows, VDMCols;
- extern long WorkspaceColorPixel;
-
- int VirtualBackgroundColorSet = FALSE;
- int VirtualForegroundColorSet = FALSE;
- int VirtualFontColorSet = FALSE;
- + int VirtualGridColorSet = False;
-
- extern GC RootGC;
- static GC VDMGC = NULL;
-
- + static int VDMMenuAction();
- +
- + List *VWList = NULL_LIST;
- +
- + static Button VDMButtons[] = {
- + #define VDM_MENU_RIGHT 0
- + { "Move Right", False, Enabled, {VDMMenuAction, (void *) NULL} },
- + #define VDM_MENU_LEFT 1
- + { "Move Left", False, Enabled, {VDMMenuAction, (void *) NULL} },
- + #define VDM_MENU_UP 2
- + { "Move Up", False, Enabled, {VDMMenuAction, (void *) NULL} },
- + #define VDM_MENU_DOWN 3
- + { "Move Down", False, Enabled, {VDMMenuAction, (void *) NULL} },
- + #define VDM_MENU_RIGHT_UP 4
- + { "Move Right/Up", False, Enabled, {VDMMenuAction, (void *) NULL} },
- + #define VDM_MENU_RIGHT_DOWN 5
- + { "Move Right/Down", False, Enabled, {VDMMenuAction, (void *) NULL} },
- + #define VDM_MENU_LEFT_UP 6
- + { "Move Left/Up", False, Enabled, {VDMMenuAction, (void *) NULL} },
- + #define VDM_MENU_LEFT_DOWN 7
- + { "Move Left/Down", False, Enabled, {VDMMenuAction, (void *) NULL} },
- + #define VDM_MENU_HOME 8
- + { "Move Home", False, Enabled, {VDMMenuAction, (void *) NULL} },
- + };
- +
- + Menu VDMMenu = { "OLVWM 2.1", VDMButtons, 9, -0, True, (FuncPtr) MakeMenu};
- +
- + #define VDMSelectMask (ButtonPressMask | ButtonReleaseMask | \
- + KeyPressMask | KeyReleaseMask | \
- + PointerMotionMask | ExposureMask | StructureNotifyMask)
- +
- MakeVirtualDesktop(dpy)
- Display *dpy;
-
- {
- int width, height;
- + char temp[4];
- + int dw = DisplayWidth(dpy, DefaultScreen(dpy));
- + int dh = DisplayHeight(dpy, DefaultScreen(dpy));
- + static int done_menu = False;
-
- sscanf(GRV.VirtualDesktop, "%dx%d", &width, &height);
- ! if (width < dw)
- ! VDMCols = width;
- ! else VDMCols = ceil((double) width / dw);
- ! if (height < dh)
- ! VDMRows = height;
- ! else VDMRows = ceil((double) height / dh);
-
- ! VirtualDesktopWidth = VDMCols * dw;
- ! VirtualDesktopHeight = VDMRows * dh;
- VirtualDesktopX = 0;
- VirtualDesktopY = 0;
- VirtualContext = XUniqueContext();
- +
- + VDMOutlineWidth = ceil((double) dw / GRV.VDMScale);
- + VDMOutlineHeight = ceil((double) dh / GRV.VDMScale);
- + if (GRV.VirtualGrid) {
- + VDMWidth = VDMCols * VDMOutlineWidth;
- + VDMHeight = VDMRows * VDMOutlineHeight;
- + }
- + else {
- + VDMWidth = VirtualDesktopWidth / GRV.VDMScale;
- + VDMHeight = VirtualDesktopHeight / GRV.VDMScale;
- + }
- + VDMOutlineX = 0;
- + VDMOutlineY = 0;
- +
- + if (!done_menu) {
- + sprintf(temp, "%0d", PATCHLEVEL);
- + width = strlen(VDMMenu.title);
- + VDMMenu.title[width - 1] = temp[0];
- + MenuCreate(dpy, &VDMMenu);
- + done_menu = True;
- + }
- }
-
- + VDMGrabKey(dpy, keysym)
- + Display *dpy;
- + int keysym;
- +
- + {
- + int keycode;
- + static int meta_mask = 0, shift_mask, control_mask;
- +
- + if (meta_mask == 0) {
- + keycode = XKeysymToKeycode(dpy, XK_Meta_L);
- + meta_mask = FindModifierMask(keycode);
- + if (meta_mask == 0)
- + return;
- + keycode = XKeysymToKeycode(dpy, XK_Shift_L);
- + shift_mask = FindModifierMask(keycode);
- + keycode = XKeysymToKeycode(dpy, XK_Control_L);
- + control_mask = FindModifierMask(keycode);
- + }
- + keycode = XKeysymToKeycode(dpy, keysym);
- + if (keycode == 0)
- + return;
- + XGrabKey(dpy, keycode, meta_mask,
- + DefaultRootWindow(dpy), False, GrabModeAsync, GrabModeAsync);
- + XGrabKey(dpy, keycode, meta_mask | shift_mask,
- + DefaultRootWindow(dpy), False, GrabModeAsync, GrabModeAsync);
- + XGrabKey(dpy, keycode, meta_mask | control_mask,
- + DefaultRootWindow(dpy), False, GrabModeAsync, GrabModeAsync);
- + XGrabKey(dpy, keycode, meta_mask | control_mask | shift_mask,
- + DefaultRootWindow(dpy), False, GrabModeAsync, GrabModeAsync);
- + }
- +
- MakeVDM(dpy)
- Display *dpy;
-
- ***************
- *** 76,120 ****
- XSizeHints *sizeHints;
- XWMHints *wmHints;
- XClassHint *classHints;
- ! int x, y, width, height, dummy, flags;
- Pixmap pm = None;
- unsigned attrMask;
- !
- ! width = VirtualDesktopWidth / GRV.VDMScale + 1;
- ! height = VirtualDesktopHeight / GRV.VDMScale + 1;
-
- sizeHints = XAllocSizeHints();
- sizeHints->flags = PBaseSize;
- ! sizeHints->base_width = width;
- ! sizeHints->base_height = height;
- ! sizeHints->min_width = DisplayWidth(dpy, DefaultScreen(dpy)) /
- ! GRV.VDMScale + 1;
- ! sizeHints->min_height = DisplayHeight(dpy, DefaultScreen(dpy)) /
- ! GRV.VDMScale + 1;
- ! sizeHints->flags = USPosition|PMinSize;
- flags = XParseGeometry(GRV.VirtualGeometry, &x, &y, &dummy, &dummy);
- if (flags & XValue)
- if (flags & XNegative)
- sizeHints->x =
- ! DisplayWidth(dpy, DefaultScreen(dpy)) + x - width;
- else sizeHints->x = x;
- else sizeHints->x = 0;
- if (flags & YValue)
- if (flags & YNegative)
- sizeHints->y =
- ! DisplayHeight(dpy, DefaultScreen(dpy)) + y - height;
- else sizeHints->y = y;
- else sizeHints->y = 0;
- ! if (sizeHints->x > DisplayWidth(dpy, DefaultScreen(dpy)) - width)
- ! sizeHints->x = DisplayWidth(dpy, DefaultScreen(dpy)) - width;
- ! if (sizeHints->y > DisplayHeight(dpy, DefaultScreen(dpy)) - height)
- ! sizeHints->y = DisplayHeight(dpy, DefaultScreen(dpy)) - height;
-
- wmHints = XAllocWMHints();
- if (GRV.VirtualIconic)
- wmHints->initial_state = IconicState;
- else wmHints->initial_state = NormalState;
- ! wmHints->flags = StateHint | InputHint | IconPixmapHint | IconPositionHint;
- wmHints->input = TRUE;
- wmHints->icon_pixmap = XCreateBitmapFromData(dpy,
- DefaultRootWindow(dpy), vdm_bits,
- --- 170,215 ----
- XSizeHints *sizeHints;
- XWMHints *wmHints;
- XClassHint *classHints;
- ! int x, y, dummy, flags;
- Pixmap pm = None;
- unsigned attrMask;
- ! int keysym;
- ! char dashList[2];
-
- sizeHints = XAllocSizeHints();
- sizeHints->flags = PBaseSize;
- ! sizeHints->base_width = VDMWidth;
- ! sizeHints->base_height = VDMHeight;
- ! sizeHints->min_width = VDMOutlineWidth;
- ! sizeHints->min_height = VDMOutlineHeight;
- ! sizeHints->width_inc = VDMOutlineWidth;
- ! sizeHints->height_inc = VDMOutlineHeight;
- ! if (GRV.VirtualGrid)
- ! sizeHints->flags = USPosition | PMinSize | PResizeInc;
- ! else sizeHints->flags = USPosition|PMinSize;
- flags = XParseGeometry(GRV.VirtualGeometry, &x, &y, &dummy, &dummy);
- if (flags & XValue)
- if (flags & XNegative)
- sizeHints->x =
- ! DisplayWidth(dpy, DefaultScreen(dpy)) + x - VDMWidth;
- else sizeHints->x = x;
- else sizeHints->x = 0;
- if (flags & YValue)
- if (flags & YNegative)
- sizeHints->y =
- ! DisplayHeight(dpy, DefaultScreen(dpy)) + y - VDMHeight;
- else sizeHints->y = y;
- else sizeHints->y = 0;
- ! if (sizeHints->x > DisplayWidth(dpy, DefaultScreen(dpy)) - VDMWidth)
- ! sizeHints->x = DisplayWidth(dpy, DefaultScreen(dpy)) - VDMWidth;
- ! if (sizeHints->y > DisplayHeight(dpy, DefaultScreen(dpy)) - VDMHeight)
- ! sizeHints->y = DisplayHeight(dpy, DefaultScreen(dpy)) - VDMHeight;
-
- wmHints = XAllocWMHints();
- if (GRV.VirtualIconic)
- wmHints->initial_state = IconicState;
- else wmHints->initial_state = NormalState;
- ! wmHints->flags = StateHint | InputHint | IconPixmapHint;
- wmHints->input = TRUE;
- wmHints->icon_pixmap = XCreateBitmapFromData(dpy,
- DefaultRootWindow(dpy), vdm_bits,
- ***************
- *** 121,140 ****
- vdm_width, vdm_height,
- GRV.Fg1Color, GRV.Bg1Color, 1);
- flags = XParseGeometry(GRV.VirtualIconGeometry, &x, &y, &dummy, &dummy);
- ! if (flags & XValue)
- ! if (flags & XNegative)
- ! wmHints->icon_x = DisplayWidth(dpy, DefaultScreen(dpy)) + x - ICON_SIZE;
- ! else wmHints->icon_x = x;
- ! else wmHints->icon_x = 0;
- ! if (flags & YValue)
- ! if (flags & YNegative)
- ! wmHints->icon_y = DisplayHeight(dpy, DefaultScreen(dpy)) + y - ICON_SIZE;
- ! else wmHints->icon_y = y;
- ! else wmHints->icon_y = 0;
- ! if (wmHints->icon_x > DisplayWidth(dpy, DefaultScreen(dpy)) - ICON_SIZE)
- ! wmHints->icon_x = DisplayWidth(dpy, DefaultScreen(dpy)) - ICON_SIZE;
- ! if (wmHints->icon_y > DisplayHeight(dpy, DefaultScreen(dpy)) - ICON_SIZE)
- ! wmHints->icon_y = DisplayHeight(dpy, DefaultScreen(dpy)) - ICON_SIZE;
-
- classHints = XAllocClassHint();
- classHints->res_name = "virtualDesktop";
- --- 216,240 ----
- vdm_width, vdm_height,
- GRV.Fg1Color, GRV.Bg1Color, 1);
- flags = XParseGeometry(GRV.VirtualIconGeometry, &x, &y, &dummy, &dummy);
- ! if (flags & (XValue | YValue)) {
- ! if (flags & XValue)
- ! if (flags & XNegative)
- ! wmHints->icon_x = DisplayWidth(dpy, DefaultScreen(dpy)) +
- ! x - ICON_SIZE;
- ! else wmHints->icon_x = x;
- ! else wmHints->icon_x = 0;
- ! if (flags & YValue)
- ! if (flags & YNegative)
- ! wmHints->icon_y = DisplayHeight(dpy, DefaultScreen(dpy)) +
- ! y - ICON_SIZE;
- ! else wmHints->icon_y = y;
- ! else wmHints->icon_y = 0;
- ! if (wmHints->icon_x > DisplayWidth(dpy, DefaultScreen(dpy)) - ICON_SIZE)
- ! wmHints->icon_x = DisplayWidth(dpy, DefaultScreen(dpy)) - ICON_SIZE;
- ! if (wmHints->icon_y > DisplayHeight(dpy, DefaultScreen(dpy)) - ICON_SIZE)
- ! wmHints->icon_y = DisplayHeight(dpy, DefaultScreen(dpy)) - ICON_SIZE;
- ! wmHints->flags |= IconPositionHint;
- ! }
-
- classHints = XAllocClassHint();
- classHints->res_name = "virtualDesktop";
- ***************
- *** 159,180 ****
- XCopyGC(dpy, RootGC, GCFunction | GCPlaneMask | GCForeground |
- GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
- GCJoinStyle | GCFillRule | GCFont, VDMGC);
- ! XSetFunction(dpy, VDMGC, GXset);
- XSetFont(dpy, VDMGC, GRV.VirtualFont->fid);
- if (VirtualFontColorSet)
- XSetForeground(dpy, VDMGC, GRV.VirtualFontColor);
- if (VirtualForegroundColorSet)
- XSetBackground(dpy, VDMGC, GRV.VirtualForegroundColor);
- else XSetBackground(dpy, VDMGC, GRV.Bg1Color);
- - if (GRV.VirtualBackgroundMap) {
- - if (pm != None)
- - XFreePixmap(dpy, pm);
- - if (pm = CreateVirtualPixmap(dpy)) {
- - attrMask &= ~CWBackPixel;
- - attrMask |= CWBackPixmap;
- - attr.background_pixmap = pm;
- - }
- - }
-
- VDM = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)),
- sizeHints->x, sizeHints->y,
- --- 259,274 ----
- XCopyGC(dpy, RootGC, GCFunction | GCPlaneMask | GCForeground |
- GCBackground | GCLineWidth | GCLineStyle | GCCapStyle |
- GCJoinStyle | GCFillRule | GCFont, VDMGC);
- ! XSetFunction(dpy, VDMGC, GXcopy);
- XSetFont(dpy, VDMGC, GRV.VirtualFont->fid);
- + dashList[0] = 0;
- + dashList[1] = 1;
- + XSetDashes( dpy, VDMGC, 1, dashList, 2);
- if (VirtualFontColorSet)
- XSetForeground(dpy, VDMGC, GRV.VirtualFontColor);
- if (VirtualForegroundColorSet)
- XSetBackground(dpy, VDMGC, GRV.VirtualForegroundColor);
- else XSetBackground(dpy, VDMGC, GRV.Bg1Color);
-
- VDM = XCreateWindow(dpy, RootWindow(dpy, DefaultScreen(dpy)),
- sizeHints->x, sizeHints->y,
- ***************
- *** 181,200 ****
- sizeHints->base_width, sizeHints->base_height, 1,
- DefaultDepth(dpy, DefaultScreen(dpy)), InputOutput,
- CopyFromParent, attrMask, &attr);
- if (pm != None)
- XFreePixmap(dpy, pm);
-
- - VDMWidth = sizeHints->base_width;
- - VDMHeight = sizeHints->base_height;
- - VDMOutlineWidth = VDMWidth /
- - ((width * GRV.VDMScale) /
- - DisplayWidth(dpy,DefaultScreen(dpy)));
- - VDMOutlineHeight = VDMHeight /
- - ((height * GRV.VDMScale)
- - / DisplayHeight(dpy,DefaultScreen(dpy)));
- - VDMOutlineX = 0;
- - VDMOutlineY = 0;
- -
- XSetWMProperties(dpy, VDM, &wName, &iName, NULL, 0,
- sizeHints, wmHints, classHints);
- XFree(sizeHints);
- --- 275,293 ----
- sizeHints->base_width, sizeHints->base_height, 1,
- DefaultDepth(dpy, DefaultScreen(dpy)), InputOutput,
- CopyFromParent, attrMask, &attr);
- + /*
- + * Have to do this after the VDM is created because of the GC stuff
- + */
- + if (GRV.VirtualBackgroundMap) {
- + if (pm != None)
- + XFreePixmap(dpy, pm);
- + if (pm = CreateVirtualPixmap(dpy))
- + XSetWindowBackgroundPixmap(dpy, VDM, pm);
- + }
- + VWList = ListCons(VDM, VWList);
- if (pm != None)
- XFreePixmap(dpy, pm);
-
- XSetWMProperties(dpy, VDM, &wName, &iName, NULL, 0,
- sizeHints, wmHints, classHints);
- XFree(sizeHints);
- ***************
- *** 202,207 ****
- --- 295,314 ----
- XFree(classHints);
- XMapRaised(dpy, VDM);
-
- + if (!GRV.GrabVirtualKeys)
- + return;
- + for (keysym = XK_R7; keysym <= XK_R15; keysym++)
- + VDMGrabKey(dpy, keysym);
- + /*
- + * Why don't these arrow keys map to R8, R10, R12, R14
- + */
- + VDMGrabKey(dpy, XK_Left);
- + VDMGrabKey(dpy, XK_Right);
- + VDMGrabKey(dpy, XK_Down);
- + VDMGrabKey(dpy, XK_Up);
- +
- + for (keysym = XK_F1; keysym <= XK_F10; keysym++)
- + VDMGrabKey(dpy, keysym);
- }
-
- VirtualSetUpFrame(cli, frame)
- ***************
- *** 226,233 ****
- GFrameSetConfig(cli->framewin, cli->framewin->core.x - dx,
- cli->framewin->core.y - dy,
- cli->framewin->core.width, cli->framewin->core.height);
- - /*cli->framewin->core.x -= dx;
- - cli->framewin->core.y -= dy;*/
- }
- }
-
- --- 333,338 ----
- ***************
- *** 269,277 ****
- virtual = XCreateSimpleWindow(dpy, VDM, x, y,
- width, height, 1, GRV.BorderColor,
- VirtualForegroundColorSet ? GRV.VirtualForegroundColor : GRV.Bg1Color);
- if (PANEWINOFCLIENT(cli) != VDM)
- ! XSelectInput(dpy, virtual, ButtonPressMask | ExposureMask);
- ! else XSelectInput(dpy, virtual, ExposureMask);
- XSaveContext(dpy, virtual, VirtualContext, cli);
- cli->virtualWindow = virtual;
- cli->virtualInactive = MakeVirtualIcon(cli, dpy);
- --- 374,383 ----
- virtual = XCreateSimpleWindow(dpy, VDM, x, y,
- width, height, 1, GRV.BorderColor,
- VirtualForegroundColorSet ? GRV.VirtualForegroundColor : GRV.Bg1Color);
- + VWList = ListCons(virtual, VWList);
- if (PANEWINOFCLIENT(cli) != VDM)
- ! XSelectInput(dpy, virtual, VDMSelectMask);
- ! else XSelectInput(dpy, virtual, ExposureMask | StructureNotifyMask);
- XSaveContext(dpy, virtual, VirtualContext, cli);
- cli->virtualWindow = virtual;
- cli->virtualInactive = MakeVirtualIcon(cli, dpy);
- ***************
- *** 309,315 ****
- if (XFindContext(dpy, ev->xany.window, VirtualContext, &cli) != 0)
- return; /* Window is destroyed . . . */
-
- ! XClearArea(dpy, ev->xany.window, 1, 1, 0, 0, False);
- XDrawImageString(dpy, ev->xany.window, VDMGC, 1,
- GRV.VirtualFont->max_bounds.ascent + 1,
- cli->framewin->fcore.name,
- --- 415,421 ----
- if (XFindContext(dpy, ev->xany.window, VirtualContext, &cli) != 0)
- return; /* Window is destroyed . . . */
-
- ! XClearArea(dpy, ev->xany.window, 0, 0, 0, 0, False);
- XDrawImageString(dpy, ev->xany.window, VDMGC, 1,
- GRV.VirtualFont->max_bounds.ascent + 1,
- cli->framewin->fcore.name,
- ***************
- *** 339,345 ****
- virtual = XCreateSimpleWindow(dpy, VDM, x, y,
- width, height, 1, GRV.BorderColor,
- VirtualForegroundColorSet ? GRV.VirtualForegroundColor : GRV.Bg1Color);
- ! XSelectInput(dpy, virtual, ButtonPressMask | KeyPressMask | ExposureMask);
- XSaveContext(dpy, virtual, VirtualContext, cli);
- return virtual;
- }
- --- 445,452 ----
- virtual = XCreateSimpleWindow(dpy, VDM, x, y,
- width, height, 1, GRV.BorderColor,
- VirtualForegroundColorSet ? GRV.VirtualForegroundColor : GRV.Bg1Color);
- ! VWList = ListCons(virtual, VWList);
- ! XSelectInput(dpy, virtual, VDMSelectMask);
- XSaveContext(dpy, virtual, VirtualContext, cli);
- return virtual;
- }
- ***************
- *** 354,364 ****
- if (ev->xexpose.count)
- return;
-
- XClearArea(dpy, VDM, 0, 0, 0, 0, 0);
- XDrawRectangle(dpy, VDM, VDMGC,
- ! VDMOutlineX, VDMOutlineY,
- ! VDMOutlineWidth, VDMOutlineHeight);
- ! while (XCheckTypedWindowEvent(dpy, VDM, Expose, &dummy));
- }
-
- VDMEvents(dpy, ev)
- --- 461,502 ----
- if (ev->xexpose.count)
- return;
-
- + DrawVDMGrid(dpy);
- + while (XCheckTypedWindowEvent(dpy, VDM, Expose, &dummy));
- + }
- +
- + DrawVDMGrid(dpy)
- + Display *dpy;
- +
- + {
- + int i;
- + XPoint pts[2];
- +
- XClearArea(dpy, VDM, 0, 0, 0, 0, 0);
- + if (VirtualGridColorSet)
- + XSetForeground(dpy, VDMGC, GRV.VirtualGridColor);
- + if (GRV.VirtualGrid == 2) {
- + XSetLineAttributes(dpy, VDMGC, 1, LineOnOffDash, CapNotLast, JoinMiter);
- + pts[0].y = 0;
- + pts[1].y = VDMHeight;
- + for (i = 0; i < VDMWidth; i += VDMOutlineWidth) {
- + pts[0].x = pts[1].x = i;
- + XDrawLines(dpy, VDM, VDMGC, pts, 2, CoordModeOrigin);
- + }
- + pts[0].x = 0;
- + pts[1].x = VDMWidth;
- + for (i = 0; i < VDMHeight; i += VDMOutlineHeight) {
- + pts[0].y = pts[1].y = i;
- + XDrawLines(dpy, VDM, VDMGC, pts, 2, CoordModeOrigin);
- + }
- + XSetLineAttributes(dpy, VDMGC, 1, LineSolid, CapNotLast, JoinMiter);
- + }
- XDrawRectangle(dpy, VDM, VDMGC,
- ! VDMOutlineX, VDMOutlineY, VDMOutlineWidth, VDMOutlineHeight);
- ! if (VirtualGridColorSet)
- ! if (VirtualFontColorSet)
- ! XSetForeground(dpy, VDMGC, GRV.VirtualFontColor);
- ! else XSetForeground(dpy, VDMGC, GRV.Fg1Color);
- }
-
- VDMEvents(dpy, ev)
- ***************
- *** 377,386 ****
- XBell(dpy, 100);
- break;
- case ButtonPress:
- ! if (MouseButton(dpy, ev) != MB_SELECT)
- ! return;
- ! if (HandleVDMButtonPress(dpy, ev))
- ! state = 1;
- break;
- case ButtonRelease:
- if (!state)
- --- 515,532 ----
- XBell(dpy, 100);
- break;
- case ButtonPress:
- ! switch(MouseButton(dpy, ev)) {
- ! case MB_SELECT:
- ! if (HandleVDMButtonPress(dpy, ev))
- ! state = 1;
- ! break;
- ! case MB_MENU:
- ! MenuShow(dpy, NULL, &VDMMenu, ev);
- ! break;
- ! case MB_ADJUST:
- ! /* I really should do this someday . . .*/
- ! break;
- ! }
- break;
- case ButtonRelease:
- if (!state)
- ***************
- *** 455,469 ****
- }
- #endif
-
- ! IsVirtual(w)
- Window w;
-
- {
- ! if (w == VDM)
- ! return TRUE;
- ! if (!WIGetInfo(w))
- ! return TRUE;
- ! return FALSE;
- }
-
- VirtualEvents(dpy, ev)
- --- 601,633 ----
- }
- #endif
-
- ! FindVW(w1, w2)
- ! Window w1, w2;
- !
- ! {
- ! if (w1 == w2)
- ! return w1;
- ! return NULL;
- ! }
- !
- ! IsVirtual(dpy, w)
- ! Display *dpy;
- Window w;
-
- {
- ! Client *cli;
- !
- ! if (ListApply(VWList, FindVW, w) != NULL) {
- ! if (XFindContext(dpy, w, VirtualContext, &cli) != 0)
- ! /*
- ! * REMIND: Can this happen?
- ! */
- ! return True;
- ! if (cli->wmState == IconicState)
- ! return cli->iconwin->core.self;
- ! else return cli->framewin->core.self;
- ! }
- ! return False;
- }
-
- VirtualEvents(dpy, ev)
- ***************
- *** 472,477 ****
- --- 636,642 ----
-
- {
- Client *cli;
- + Window dummy;
-
- if (ev->xany.window == VDM)
- VDMEvents(dpy, ev);
- ***************
- *** 479,494 ****
- case Expose:
- PaintVirtualWindow(dpy, ev);
- break;
- ! case ButtonPress:
- /*
- ! * Really I should do a select here and then maybe move many, but
- ! * I'm too lazy
- */
- ! if (MouseButton(dpy, ev) != MB_SELECT)
- ! return;
- if (XFindContext(dpy, ev->xany.window, VirtualContext, &cli) != 0)
- return;
- ! UserMoveVirtualWindow(dpy, ev, cli);
- break;
- case EnterNotify:
- if (GRV.FocusFollowsMouse &&
- --- 644,705 ----
- case Expose:
- PaintVirtualWindow(dpy, ev);
- break;
- !
- ! case MotionNotify:
- ! if (XFindContext(dpy, ev->xany.window, VirtualContext, &cli) != 0)
- ! return;
- ! TranslateVirtualCoords(dpy, &ev->xmotion.x_root,
- ! &ev->xmotion.y_root, &ev->xmotion.x, &ev->xmotion.y);
- ! if (cli->wmState == IconicState) {
- ! ev->xany.window = cli->iconwin->core.self;
- ! GFrameEventMotionNotify(dpy, ev, cli->iconwin);
- ! }
- ! else {
- ! ev->xany.window = cli->framewin->core.self;
- ! GFrameEventMotionNotify(dpy, ev, cli->framewin);
- ! }
- ! break;
- !
- ! case ButtonRelease:
- ! if (XFindContext(dpy, ev->xany.window, VirtualContext, &cli) != 0)
- ! return;
- /*
- ! * We translate events for adjust and select so that those
- ! * routines will think we actually selected on the frame. But
- ! * we don't do that for menus, because we want the menu to come
- ! * up in the absolute place
- */
- ! if (MouseButton(dpy, ev) == MB_MENU)
- ! TranslateVirtualCoords(dpy, NULL, NULL,
- ! &ev->xbutton.x, &ev->xbutton.y);
- ! else TranslateVirtualCoords(dpy, &ev->xbutton.x_root,
- ! &ev->xbutton.y_root, &ev->xbutton.x, &ev->xbutton.y);
- ! if (cli->wmState == IconicState) {
- ! ev->xany.window = cli->iconwin->core.self;
- ! GFrameEventButtonRelease(dpy, ev, cli->iconwin);
- ! }
- ! else {
- ! ev->xany.window = cli->framewin->core.self;
- ! GFrameEventButtonRelease(dpy, ev, cli->framewin);
- ! }
- ! break;
- !
- ! case ButtonPress:
- if (XFindContext(dpy, ev->xany.window, VirtualContext, &cli) != 0)
- return;
- ! if (MouseButton(dpy, ev) == MB_MENU)
- ! TranslateVirtualCoords(dpy, NULL, NULL,
- ! &ev->xbutton.x, &ev->xbutton.y);
- ! else TranslateVirtualCoords(dpy, &ev->xbutton.x_root,
- ! &ev->xbutton.y_root, &ev->xbutton.x, &ev->xbutton.y);
- ! if (cli->wmState == IconicState) {
- ! ev->xany.window = cli->iconwin->core.self;
- ! GFrameEventButtonPress(dpy, ev, cli->iconwin);
- ! }
- ! else {
- ! ev->xany.window = cli->framewin->core.self;
- ! GFrameEventButtonPress(dpy, ev, cli->framewin);
- ! }
- break;
- case EnterNotify:
- if (GRV.FocusFollowsMouse &&
- ***************
- *** 497,502 ****
- --- 708,716 ----
- RevertToPointerRoot, CurrentTime);
- }
- break;
- + case DestroyNotify:
- + VWList = ListDestroyCellByValue(ev->xany.window, VWList);
- + break;
- }
- }
-
- ***************
- *** 509,544 ****
- int doit = FALSE;
- int dw = DisplayWidth(dpy, DefaultScreen(dpy));
- int dh = DisplayHeight(dpy, DefaultScreen(dpy));
- KeySym symbol;
- enum st_retval ReplaceSticky();
-
- deltas.delta_x = deltas.delta_y = 0;
- symbol = XLookupKeysym(ev, 0);
- switch(symbol) {
- case XK_Left:
- ! deltas.delta_x = -dw;
- doit = TRUE;
- break;
- case XK_Up:
- ! deltas.delta_y = -dh;
- doit = TRUE;
- break;
- case XK_Right:
- ! deltas.delta_x = dw;
- doit = TRUE;
- break;
- case XK_Down:
- ! deltas.delta_y = dh;
- doit = TRUE;
- break;
- case XK_R7:
- ! deltas.delta_x = -dw;
- ! deltas.delta_y = -dh;
- doit = TRUE;
- break;
- case XK_R9:
- ! deltas.delta_x = dw;
- ! deltas.delta_y = -dh;
- doit = TRUE;
- break;
- case XK_R11:
- --- 723,778 ----
- int doit = FALSE;
- int dw = DisplayWidth(dpy, DefaultScreen(dpy));
- int dh = DisplayHeight(dpy, DefaultScreen(dpy));
- + int screen;
- + double factor;
- KeySym symbol;
- enum st_retval ReplaceSticky();
-
- + if (ev->xkey.type != KeyPress)
- + return; /* Root window uses same function for Up and Down events */
- deltas.delta_x = deltas.delta_y = 0;
- symbol = XLookupKeysym(ev, 0);
- +
- + switch(ev->xkey.state & (ShiftMask|ControlMask)) {
- + case ShiftMask:
- + factor = 2;
- + break;
- + case ControlMask:
- + factor = .5;
- + break;
- + case ShiftMask|ControlMask:
- + factor = 20;
- + break;
- + default:
- + factor = 1;
- + break;
- + }
- +
- switch(symbol) {
- case XK_Left:
- ! deltas.delta_x = -dw * factor;
- doit = TRUE;
- break;
- case XK_Up:
- ! deltas.delta_y = -dh * factor;
- doit = TRUE;
- break;
- case XK_Right:
- ! deltas.delta_x = dw * factor;
- doit = TRUE;
- break;
- case XK_Down:
- ! deltas.delta_y = dh * factor;
- doit = TRUE;
- break;
- case XK_R7:
- ! deltas.delta_x = -dw * factor;
- ! deltas.delta_y = -dh * factor;
- doit = TRUE;
- break;
- case XK_R9:
- ! deltas.delta_x = dw * factor;
- ! deltas.delta_y = -dh * factor;
- doit = TRUE;
- break;
- case XK_R11:
- ***************
- *** 547,586 ****
- doit = TRUE;
- break;
- case XK_R13:
- ! deltas.delta_x = -dw;
- ! deltas.delta_y = dh;
- doit = TRUE;
- break;
- case XK_R15:
- ! deltas.delta_x = dw;
- ! deltas.delta_y = dh;
- doit = TRUE;
- break;
- default:
- break;
- }
- if (!doit)
- return FALSE;
-
- ! if (VirtualDesktopX - deltas.delta_x < dw - VirtualDesktopWidth)
- ! deltas.delta_x = VirtualDesktopX + VirtualDesktopWidth - dw;
- ! else if (VirtualDesktopX - deltas.delta_x > 0)
- ! deltas.delta_x = VirtualDesktopX;
- ! if (VirtualDesktopY - deltas.delta_y < dh - VirtualDesktopHeight)
- ! deltas.delta_y = VirtualDesktopY + VirtualDesktopHeight - dh;
- ! else if (VirtualDesktopY - deltas.delta_y > 0)
- ! deltas.delta_y = VirtualDesktopY;
-
- if (fabs(deltas.delta_x) < 0.1 && fabs(deltas.delta_y) < 0.1)
- return FALSE;
- !
- ! VDMOutlineX = (-VirtualDesktopX + deltas.delta_x) / GRV.VDMScale;
- ! VDMOutlineY = (-VirtualDesktopY + deltas.delta_y) / GRV.VDMScale;
- !
- MoveDesktop(dpy, &deltas);
- return TRUE;
- }
-
- MoveDesktop(dpy, deltas)
- Display *dpy;
- struct deltas *deltas;
- --- 781,861 ----
- doit = TRUE;
- break;
- case XK_R13:
- ! deltas.delta_x = -dw * factor;
- ! deltas.delta_y = dh * factor;
- doit = TRUE;
- break;
- case XK_R15:
- ! deltas.delta_x = dw * factor;
- ! deltas.delta_y = dh * factor;
- doit = TRUE;
- break;
- default:
- break;
- }
- + if (!doit && symbol >= XK_F1 && symbol <= XK_F10) {
- + switch(ev->xkey.state & (ShiftMask|ControlMask)) {
- + case ShiftMask:
- + factor = 2;
- + break;
- + case ControlMask:
- + factor = 1;
- + break;
- + case ShiftMask|ControlMask:
- + factor = 3;
- + break;
- + default:
- + factor = 0;
- + break;
- + }
- + doit = TRUE;
- + deltas.delta_x = VirtualDesktopX;
- + deltas.delta_y = VirtualDesktopY;
- + screen = symbol - XK_F1 + 10 * factor;
- + deltas.delta_x += dw * (screen % VDMCols);
- + deltas.delta_y += dh * (screen / VDMCols);
- + }
- if (!doit)
- return FALSE;
-
- ! constrain_deltas(dpy, &deltas);
-
- if (fabs(deltas.delta_x) < 0.1 && fabs(deltas.delta_y) < 0.1)
- return FALSE;
- ! MoveVDMOutline(dpy, &deltas);
- MoveDesktop(dpy, &deltas);
- return TRUE;
- }
-
- + MoveVDMOutline(dpy, deltas)
- + Display *dpy;
- + struct deltas *deltas;
- + {
- + if (deltas->delta_x < 0)
- + VDMOutlineX -= ceil(-deltas->delta_x / GRV.VDMScale);
- + else VDMOutlineX += ceil(deltas->delta_x / GRV.VDMScale);
- + if (deltas->delta_y < 0)
- + VDMOutlineY -= ceil(-deltas->delta_y / GRV.VDMScale);
- + else VDMOutlineY += ceil(deltas->delta_y / GRV.VDMScale);
- + }
- +
- + constrain_deltas(dpy, deltas)
- + Display *dpy;
- + struct deltas *deltas;
- + {
- + int dw = DisplayWidth(dpy, DefaultScreen(dpy));
- + int dh = DisplayHeight(dpy, DefaultScreen(dpy));
- +
- + if (VirtualDesktopX - deltas->delta_x < dw - VirtualDesktopWidth)
- + deltas->delta_x = VirtualDesktopX + VirtualDesktopWidth - dw;
- + else if (VirtualDesktopX - deltas->delta_x > 0)
- + deltas->delta_x = VirtualDesktopX;
- + if (VirtualDesktopY - deltas->delta_y < dh - VirtualDesktopHeight)
- + deltas->delta_y = VirtualDesktopY + VirtualDesktopHeight - dh;
- + else if (VirtualDesktopY - deltas->delta_y > 0)
- + deltas->delta_y = VirtualDesktopY;
- + }
- +
- MoveDesktop(dpy, deltas)
- Display *dpy;
- struct deltas *deltas;
- ***************
- *** 590,595 ****
- --- 865,873 ----
-
- VirtualDesktopX -= deltas->delta_x;
- VirtualDesktopY -= deltas->delta_y;
- + VDMOutlineX = ceil((double) -VirtualDesktopX / GRV.VDMScale);
- + VDMOutlineY = ceil((double) -VirtualDesktopY / GRV.VDMScale);
- + DrawVDMGrid(dpy);
- WIApply(ReplaceSticky, deltas);
- event.xexpose.count = 0;
- HandleVDMExpose(dpy, &event);
- ***************
- *** 659,664 ****
- --- 937,944 ----
- int VDMPointerX = -1;
- int VDMPointerY;
- int VDMInitX, VDMInitY;
- + int VDMLastSelectTime = 0;
- + int NumVDMMoves = 0;
-
- HandleVDMButtonPress(dpy, ev)
- Display *dpy;
- ***************
- *** 667,685 ****
- {
- VDMPointerX = ev->xbutton.x;
- VDMPointerY = ev->xbutton.y;
- ! if (VDMPointerX < VDMOutlineX ||
- ! VDMPointerX > VDMOutlineX + VDMOutlineWidth)
- ! return FALSE;
- ! if (VDMPointerY < VDMOutlineY ||
- ! VDMPointerY > VDMOutlineY + VDMOutlineHeight)
- ! return FALSE;
- ! XClearWindow(dpy, VDM);
- XDrawRectangle(dpy, VDM, VDMGC,
- VDMOutlineX, VDMOutlineY,
- VDMOutlineWidth, VDMOutlineHeight);
- VDMInitX = VDMOutlineX;
- VDMInitY = VDMOutlineY;
- ! return TRUE;
- }
-
- HandleVDMButtonRelease(dpy, ev)
- --- 947,960 ----
- {
- VDMPointerX = ev->xbutton.x;
- VDMPointerY = ev->xbutton.y;
- ! XSetFunction(dpy, VDMGC, GXxor);
- XDrawRectangle(dpy, VDM, VDMGC,
- VDMOutlineX, VDMOutlineY,
- VDMOutlineWidth, VDMOutlineHeight);
- VDMInitX = VDMOutlineX;
- VDMInitY = VDMOutlineY;
- ! NumVDMMoves = 0;
- ! return True;
- }
-
- HandleVDMButtonRelease(dpy, ev)
- ***************
- *** 688,696 ****
-
- {
- struct deltas deltas;
-
- ! XClearWindow(dpy, VDM);
- ! constrain_vdm_outline(ev->xbutton.x, ev->xbutton.y);
- XDrawRectangle(dpy, VDM, VDMGC, VDMOutlineX, VDMOutlineY,
- VDMOutlineWidth, VDMOutlineHeight);
- deltas.delta_x = (VDMOutlineX - VDMInitX) * GRV.VDMScale;
- --- 963,994 ----
-
- {
- struct deltas deltas;
- + int dw = DisplayWidth(dpy, DefaultScreen(dpy));
- + int dh = DisplayHeight(dpy, DefaultScreen(dpy));
-
- ! XDrawRectangle(dpy, VDM, VDMGC,
- ! VDMOutlineX, VDMOutlineY,
- ! VDMOutlineWidth, VDMOutlineHeight);
- ! XSetFunction(dpy, VDMGC, GXcopy);
- !
- ! if (ev->xbutton.time - VDMLastSelectTime <= GRV.DoubleClickTime) {
- ! deltas.delta_x = VirtualDesktopX;
- ! deltas.delta_y = VirtualDesktopY;
- ! deltas.delta_x += dw * (ev->xbutton.x / VDMOutlineWidth);
- ! deltas.delta_y += dh * (ev->xbutton.y / VDMOutlineHeight);
- ! constrain_deltas(dpy, &deltas);
- ! MoveVDMOutline(dpy, &deltas);
- ! MoveDesktop(dpy, &deltas);
- ! return False;
- ! }
- ! VDMLastSelectTime = ev->xbutton.time;
- !
- ! if (!NumVDMMoves)
- ! return;
- ! constrain_vdm_outline(ev->xbutton.x, ev->xbutton.y,
- ! (GRV.VirtualGrid) ? !(ev->xbutton.state & ControlMask) :
- ! (ev->xbutton.state & ControlMask));
- ! DrawVDMGrid(dpy);
- XDrawRectangle(dpy, VDM, VDMGC, VDMOutlineX, VDMOutlineY,
- VDMOutlineWidth, VDMOutlineHeight);
- deltas.delta_x = (VDMOutlineX - VDMInitX) * GRV.VDMScale;
- ***************
- *** 706,735 ****
- {
- if (VDMPointerX == -1)
- return;
- - XClearWindow(dpy, VDM);
- - constrain_vdm_outline(ev->xmotion.x, ev->xmotion.y);
- -
- XDrawRectangle(dpy, VDM, VDMGC,
- VDMOutlineX, VDMOutlineY,
- VDMOutlineWidth, VDMOutlineHeight);
- }
-
- ! constrain_vdm_outline(x, y)
- ! int x, y;
-
- {
- ! VDMOutlineX = x - VDMPointerX + VDMInitX;
- ! VDMOutlineY = y - VDMPointerY + VDMInitY;
-
- if (VDMOutlineX < 0)
- VDMOutlineX = 0;
- ! else if (VDMOutlineX + VDMOutlineWidth >= VDMWidth)
- ! VDMOutlineX = VDMWidth - VDMOutlineWidth - 1;
-
- if (VDMOutlineY < 0)
- VDMOutlineY = 0;
- ! else if (VDMOutlineY + VDMOutlineHeight >= VDMHeight)
- ! VDMOutlineY = VDMHeight - VDMOutlineHeight - 1;
- }
-
- int SaveVDX = -1, SaveVDY;
- --- 1004,1043 ----
- {
- if (VDMPointerX == -1)
- return;
- XDrawRectangle(dpy, VDM, VDMGC,
- VDMOutlineX, VDMOutlineY,
- VDMOutlineWidth, VDMOutlineHeight);
- + constrain_vdm_outline(ev->xmotion.x, ev->xmotion.y,
- + (GRV.VirtualGrid) ? !(ev->xbutton.state & ControlMask) :
- + (ev->xbutton.state & ControlMask));
- + XDrawRectangle(dpy, VDM, VDMGC,
- + VDMOutlineX, VDMOutlineY,
- + VDMOutlineWidth, VDMOutlineHeight);
- + NumVDMMoves++;
- }
-
- ! constrain_vdm_outline(x, y, snap)
- ! int x, y, snap;
-
- {
- ! if (snap) {
- ! VDMOutlineX = (x / VDMOutlineWidth) * VDMOutlineWidth;
- ! VDMOutlineY = (y / VDMOutlineHeight) * VDMOutlineHeight;
- ! }
- ! else {
- ! VDMOutlineX = x - VDMPointerX + VDMInitX;
- ! VDMOutlineY = y - VDMPointerY + VDMInitY;
- ! }
-
- if (VDMOutlineX < 0)
- VDMOutlineX = 0;
- ! else if (VDMOutlineX + VDMOutlineWidth > VDMWidth)
- ! VDMOutlineX = VDMWidth - VDMOutlineWidth;
-
- if (VDMOutlineY < 0)
- VDMOutlineY = 0;
- ! else if (VDMOutlineY + VDMOutlineHeight > VDMHeight)
- ! VDMOutlineY = VDMHeight - VDMOutlineHeight;
- }
-
- int SaveVDX = -1, SaveVDY;
- ***************
- *** 783,803 ****
- Client *cli;
-
- if (isUpdate) {
- ! sscanf(GRV.VirtualDesktop, "%dx%d", &width, &height);
- ! if (width < DisplayWidth(dpy,DefaultScreen(dpy)))
- ! width = width * DisplayWidth(dpy,DefaultScreen(dpy));
- ! if (height < DisplayHeight(dpy,DefaultScreen(dpy)))
- ! height = height * DisplayHeight(dpy,DefaultScreen(dpy));
- if (XFindContext(dpy, VDM, VirtualContext, &cli) != 0)
- ! return TRUE;
- ! GFrameSetConfig(cli->framewin, (int) cli->framewin->core.x,
- ! (int) cli->framewin->core.y,
- ! width / GRV.VDMScale + 1 +
- ! widthLeftFrame(cli->framewin) + widthRightFrame(cli->framewin),
- ! height / GRV.VDMScale + 1 +
- ! heightTopFrame(cli->framewin) + heightBottomFrame(cli->framewin));
- }
- ! return TRUE;
- }
-
- Bool
- --- 1091,1102 ----
- Client *cli;
-
- if (isUpdate) {
- ! MakeVirtualDesktop(dpy);
- if (XFindContext(dpy, VDM, VirtualContext, &cli) != 0)
- ! return True;
- ! ResizeProgVirtual(dpy, cli);
- }
- ! return True;
- }
-
- Bool
- ***************
- *** 919,925 ****
- {
- if (isUpdate) {
- XSetWindowBackground(dpy, VDM, GRV.VirtualBackgroundColor);
- ! XClearWindow(dpy, VDM);
- }
- return TRUE;
- }
- --- 1218,1224 ----
- {
- if (isUpdate) {
- XSetWindowBackground(dpy, VDM, GRV.VirtualBackgroundColor);
- ! DrawVDMGrid(dpy);
- }
- return TRUE;
- }
- ***************
- *** 973,979 ****
- if (isUpdate) {
- if (write = CreateVirtualPixmap(dpy)) {
- XSetWindowBackgroundPixmap(dpy, VDM, write);
- ! XClearWindow(dpy, VDM);
- XFreePixmap(dpy, write);
- }
- }
- --- 1272,1278 ----
- if (isUpdate) {
- if (write = CreateVirtualPixmap(dpy)) {
- XSetWindowBackgroundPixmap(dpy, VDM, write);
- ! DrawVDMGrid(dpy);
- XFreePixmap(dpy, write);
- }
- }
- ***************
- *** 987,992 ****
- --- 1286,1292 ----
- Pixmap read, write;
- int w, h, dummy;
- GC gc;
- + XGCValues gcv;
-
- if (XReadBitmapFile(dpy, RootWindow(dpy, DefaultScreen(dpy)),
- GRV.VirtualBackgroundMap, &w, &h,
- ***************
- *** 993,1005 ****
- &read, &dummy, &dummy) == BitmapSuccess) {
- write = XCreatePixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)),
- w, h, DefaultDepth(dpy, DefaultScreen(dpy)));
- ! gc = XCreateGC(dpy, VDM, 0, NULL);
- XCopyGC(dpy, VDMGC, GCForeground | GCBackground, gc);
- ! /*
- ! * Why doesn't this color stuff work on startup?
- ! */
- ! if (VirtualForegroundColorSet)
- ! XSetForeground(dpy, gc, GRV.VirtualForegroundColor);
- if (VirtualBackgroundColorSet)
- XSetBackground(dpy, gc, GRV.VirtualBackgroundColor);
- XCopyPlane(dpy, read, write, gc, 0, 0, w, h, 0, 0, 1);
- --- 1293,1302 ----
- &read, &dummy, &dummy) == BitmapSuccess) {
- write = XCreatePixmap(dpy, RootWindow(dpy, DefaultScreen(dpy)),
- w, h, DefaultDepth(dpy, DefaultScreen(dpy)));
- ! gcv.function = GXcopy;
- ! gc = XCreateGC(dpy, VDM, GCFunction, &gcv);
- XCopyGC(dpy, VDMGC, GCForeground | GCBackground, gc);
- ! XSetForeground(dpy, gc, GRV.VirtualPixmapColor);
- if (VirtualBackgroundColorSet)
- XSetBackground(dpy, gc, GRV.VirtualBackgroundColor);
- XCopyPlane(dpy, read, write, gc, 0, 0, w, h, 0, 0, 1);
- ***************
- *** 1019,1059 ****
- int doit;
- struct deltas deltas;
- int temp;
-
- ! VirtualDesktopHeight = (height - 1) * GRV.VDMScale;
- ! VirtualDesktopWidth = (width - 1) * GRV.VDMScale;
- ! temp = nint((double) VirtualDesktopHeight /
- ! (double) DisplayHeight(dpy, DefaultScreen(dpy))) *
- ! DisplayHeight(dpy, DefaultScreen(dpy));
- ! if (abs(temp - VirtualDesktopHeight) <= GRV.VDMScale)
- ! VirtualDesktopHeight = temp;
- ! temp = nint((double) VirtualDesktopWidth /
- ! (double) DisplayWidth(dpy, DefaultScreen(dpy))) *
- ! DisplayWidth(dpy, DefaultScreen(dpy));
- ! if (abs(temp - VirtualDesktopWidth) <= GRV.VDMScale)
- ! VirtualDesktopWidth = temp;
- ! VDMWidth = width;
- ! VDMHeight = height;
- doit = FALSE;
- deltas.delta_x = deltas.delta_y = 0;
- ! if (VDMOutlineX + VDMOutlineWidth > VDMWidth - 1) {
- doit = TRUE;
- ! deltas.delta_x = (VDMWidth - VDMOutlineWidth - 1 -
- VDMOutlineX) * GRV.VDMScale;
- ! VDMOutlineX = (-VirtualDesktopX + deltas.delta_x) /
- ! GRV.VDMScale;
- }
- ! if (VDMOutlineY + VDMOutlineHeight > VDMHeight - 1) {
- doit = TRUE;
- ! deltas.delta_y = (VDMHeight - VDMOutlineHeight - 1 -
- VDMOutlineY) * GRV.VDMScale;
- ! VDMOutlineY = (-VirtualDesktopY + deltas.delta_y) /
- ! GRV.VDMScale;
- }
- if (doit) {
- MoveDesktop(dpy, &deltas);
- RecursiveRefresh(dpy, VDM);
- ! }
- }
-
- Bool
- --- 1316,1365 ----
- int doit;
- struct deltas deltas;
- int temp;
- + int dw = DisplayWidth(dpy, DefaultScreen(dpy));
- + int dh = DisplayHeight(dpy, DefaultScreen(dpy));
-
- ! if (GRV.VirtualGrid) {
- ! VirtualDesktopHeight = (height - 3) * GRV.VDMScale;
- ! VirtualDesktopHeight = ((VirtualDesktopHeight - 1) / dh + 1) * dh;
- ! VirtualDesktopWidth = (width - 3) * GRV.VDMScale;
- ! VirtualDesktopWidth = ((VirtualDesktopWidth - 1) / dw + 1) * dw;
- ! VDMRows = ceil((double) VirtualDesktopHeight / dh);
- ! VDMCols = ceil((double) VirtualDesktopWidth / dw);
- ! VDMWidth = VDMCols * VDMOutlineWidth;
- ! VDMHeight = VDMRows * VDMOutlineHeight;
- ! }
- ! else {
- ! VirtualDesktopHeight = height * GRV.VDMScale;
- ! VirtualDesktopWidth = width * GRV.VDMScale;
- ! VDMRows = ceil((double) VirtualDesktopHeight / dh);
- ! VDMCols = ceil((double) VirtualDesktopWidth / dw);
- ! VDMWidth = width;
- ! VDMHeight = height;
- ! }
- doit = FALSE;
- deltas.delta_x = deltas.delta_y = 0;
- ! if (VDMOutlineX + VDMOutlineWidth > VDMWidth) {
- doit = TRUE;
- ! deltas.delta_x = (VDMWidth - VDMOutlineWidth -
- VDMOutlineX) * GRV.VDMScale;
- ! if (deltas.delta_x < 0)
- ! VDMOutlineX -= ceil(-deltas.delta_x / GRV.VDMScale);
- ! else VDMOutlineX += ceil(deltas.delta_x / GRV.VDMScale);
- }
- ! if (VDMOutlineY + VDMOutlineHeight > VDMHeight) {
- doit = TRUE;
- ! deltas.delta_y = (VDMHeight - VDMOutlineHeight -
- VDMOutlineY) * GRV.VDMScale;
- ! if (deltas.delta_y < 0)
- ! VDMOutlineY -= ceil(-deltas.delta_y / GRV.VDMScale);
- ! else VDMOutlineY += ceil(deltas.delta_y / GRV.VDMScale);
- }
- if (doit) {
- MoveDesktop(dpy, &deltas);
- RecursiveRefresh(dpy, VDM);
- ! }
- ! DrawVDMGrid(dpy);
- }
-
- Bool
- ***************
- *** 1090,1096 ****
- cli->iconwin->core.width, cli->iconwin->core.height);
- }
- }
- ! return TRUE;
- }
-
- VirtualSetColor( dpy, rmIndex, newValue, varSet )
- --- 1396,1402 ----
- cli->iconwin->core.width, cli->iconwin->core.height);
- }
- }
- ! return True;
- }
-
- VirtualSetColor( dpy, rmIndex, newValue, varSet )
- ***************
- *** 1105,1109 ****
- --- 1411,1568 ----
- VirtualForegroundColorSet = TRUE;
- else if (rmIndex == RM_VIRTUALFONTCOLOR && newValue)
- VirtualFontColorSet = TRUE;
- + else if (rmIndex == RM_VIRTUALGRIDCOLOR && newValue)
- + VirtualGridColorSet = True;
- return setColor(dpy, rmIndex, newValue, varSet);
- + }
- +
- + TranslateVirtualCoords(dpy, root_x, root_y, x, y)
- + int *root_x, *root_y, *x, *y;
- +
- + {
- + int tx, ty, tw, th, bw, d;
- + Window root;
- +
- + if (x)
- + *x *= GRV.VDMScale;
- + if (y)
- + *y *= GRV.VDMScale;
- + if (!root_x || !root_y)
- + return;
- + XGetGeometry(dpy, VDMFrame, &root, &tx, &ty, &tw, &th, &bw, &d);
- + *root_x -= tx;
- + *root_y -= ty;
- + XGetGeometry(dpy, VDM, &root, &tx, &ty, &tw, &th, &bw, &d);
- + *root_x -= tx;
- + *root_y -= ty;
- + *root_x *= GRV.VDMScale;
- + *root_x += VirtualDesktopX;
- + *root_y *= GRV.VDMScale;
- + *root_y += VirtualDesktopY;
- + }
- +
- + SelectVirtual(cli, state)
- + Client *cli;
- + Bool state;
- +
- + {
- + XSetWindowBorderWidth(cli->dpy, cli->virtualWindow, state ? 2 : 1);
- + XSetWindowBorderWidth(cli->dpy, cli->virtualInactive, state ? 2 : 1);
- + }
- +
- + static int
- + VDMMenuAction(dpy, winInfo, menu, idx, pinnedMenu)
- + Display *dpy;
- + struct _wingeneric *winInfo;
- + Menu *menu;
- + int idx;
- + Bool pinnedMenu;
- +
- + {
- + struct deltas deltas;
- + int dw = DisplayWidth(dpy, DefaultScreen(dpy));
- + int dh = DisplayHeight(dpy, DefaultScreen(dpy));
- +
- + switch(idx) {
- + case VDM_MENU_LEFT:
- + deltas.delta_x = -dw;
- + break;
- + case VDM_MENU_UP:
- + deltas.delta_y = -dh;
- + break;
- + case VDM_MENU_RIGHT:
- + deltas.delta_x = dw;
- + break;
- + case VDM_MENU_DOWN:
- + deltas.delta_y = dh;
- + break;
- + case VDM_MENU_LEFT_UP:
- + deltas.delta_x = -dw;
- + deltas.delta_y = -dh;
- + break;
- + case VDM_MENU_RIGHT_UP:
- + deltas.delta_x = dw;
- + deltas.delta_y = -dh;
- + break;
- + case VDM_MENU_HOME:
- + deltas.delta_x = VirtualDesktopX;
- + deltas.delta_y = VirtualDesktopY;
- + break;
- + case VDM_MENU_LEFT_DOWN:
- + deltas.delta_x = -dw;
- + deltas.delta_y = dh;
- + break;
- + case VDM_MENU_RIGHT_DOWN:
- + deltas.delta_x = dw;
- + deltas.delta_y = dh;
- + break;
- + }
- + constrain_deltas(dpy, &deltas);
- +
- + if (fabs(deltas.delta_x) < 0.1 && fabs(deltas.delta_y) < 0.1)
- + return FALSE;
- + MoveVDMOutline(dpy, &deltas);
- + MoveDesktop(dpy, &deltas);
- + }
- +
- + Bool
- + UpdVirtualGrid(dpy, rmIndex, isUpdate)
- + Display *dpy;
- + int rmIndex;
- + Bool isUpdate;
- +
- + {
- + Client *cli;
- +
- + if (isUpdate) {
- + cli = VirtualGetClient(dpy, VDM);
- + if (!cli)
- + return True;
- + ResizeVDM(dpy,
- + cli->framewin->core.width -
- + widthLeftFrame(cli->framewin) - widthRightFrame(cli->framewin),
- + cli->framewin->core.height -
- + heightTopFrame(cli->framewin) - heightBottomFrame(cli->framewin));
- + if (GRV.VirtualGrid) {
- + cli->normHints->flags |= PResizeInc;
- + ResizeProgVirtual(dpy, cli);
- + }
- + else cli->normHints->flags &= ~PResizeInc;
- + }
- + DrawVDMGrid(dpy);
- + return True;
- + }
- +
- + ResizeProgVirtual(dpy, cli)
- + Display *dpy;
- + Client *cli;
- +
- + {
- + GFrameSetConfig(cli->framewin,
- + cli->framewin->core.x, cli->framewin->core.y,
- + VDMWidth + widthLeftFrame(cli->framewin) +
- + widthRightFrame(cli->framewin),
- + VDMHeight + heightTopFrame(cli->framewin) +
- + heightBottomFrame(cli->framewin));
- + }
- +
- + SetGridResource(dpy, rmIndex, newValue, varSet)
- + Display *dpy;
- + int rmIndex;
- + char *newValue;
- + Bool varSet;
- +
- + {
- + int new, ret;
- +
- + if (!newValue)
- + new = 2;
- + else if (matchString(newValue, "none"))
- + new = 0;
- + else if (matchString(newValue, "invisible"))
- + new = 1;
- + else new = 2;
- + ret = new != GRV.VirtualGrid;
- + GRV.VirtualGrid = new;
- + return ret;
- }
- *** build/win.c Sat Jun 22 20:09:02 1991
- --- src/win.c Sat Jun 22 20:56:18 1991
- ***************
- *** 6,12 ****
- * Written for Sun Microsystems by Crucible, Santa Cruz, CA.
- */
-
- ! static char sccsid[] = "@(#)win.c 1.2 olvwm version 3/30/91";
-
- /*
- * Based on
- --- 6,12 ----
- * Written for Sun Microsystems by Crucible, Santa Cruz, CA.
- */
-
- ! static char sccsid[] = "@(#)win.c 1.3 olvwm version 6/22/91";
-
- /*
- * Based on
- ***************
- *** 147,152 ****
- --- 147,153 ----
- callSelectTree(cli->dpy, cli->framewin, sel);
- else if (cli->wmState == IconicState)
- callSelectTree(cli->dpy, cli->iconwin, sel);
- + SelectVirtual(cli, sel);
- }
-
- /* WinCallFocus - call a client's focus functions for the frame tree.
- ***************
- *** 157,166 ****
- --- 158,179 ----
- WinGeneric *win;
- Bool focus;
- {
- + XEvent ev;
- +
- if (win == NULL)
- return;
- win->core.client->isFocus = focus;
- callFocusTree(win, focus);
- + if (!focus && XCheckWindowEvent(win->core.client->dpy,
- + win->core.self, DestroyNotify, &ev)) {
- + /*
- + * When a window goes away, we get first the Focus event and
- + * then the destroy event -- so we have to mark the client
- + * as still having focus so StateWithdrawn will work ok
- + */
- + XPutBackEvent(win->core.client->dpy, &ev);
- + win->core.client->isFocus = 1;
- + }
- }
-
- /* WinCallDestroy - call a client's destroy functions for both the icon and
- *** build/winframe.c Sat Jun 22 20:09:44 1991
- --- src/winframe.c Sat Jun 22 20:56:19 1991
- ***************
- *** 6,12 ****
- * Written for Sun Microsystems by Crucible, Santa Cruz, CA.
- */
-
- ! static char sccsid[] = "@(#)winframe.c 1.3 olvwm version 4/17/91";
-
- /*
- * Based on
- --- 6,12 ----
- * Written for Sun Microsystems by Crucible, Santa Cruz, CA.
- */
-
- ! static char sccsid[] = "@(#)winframe.c 1.4 olvwm version 6/22/91";
-
- /*
- * Based on
- ***************
- *** 1171,1181 ****
- * get the event, set the focus, and replay the event, thus passing the event
- * through.
- *
- - * SDO: We seem to get the event anyway. And grabbing the button seemed
- - * to cause lots of problems anyway, due perhaps to the grab bugs
- - * in xnews, but whatever; if the button press was destined for the
- - * VDM, we never got the button up (or anything else . . .). And
- - *
- * REMIND we need to remove explicit reference to Buttons 1 and 2.
- */
- void
- --- 1171,1176 ----
- ***************
- *** 1184,1190 ****
- Window win;
- Bool activate;
- {
- - #ifdef NOTDEF
- if (!GRV.FocusFollowsMouse) {
- switch (cli->focusMode) {
- case Passive:
- --- 1179,1184 ----
- ***************
- *** 1203,1209 ****
- break;
- }
- }
- - #endif
- }
-
-
- --- 1197,1202 ----
-
- --
- Dan Heller
- O'Reilly && Associates Z-Code Software Comp-sources-x:
- Senior Writer President comp-sources-x@uunet.uu.net
- argv@ora.com argv@zipcode.com
-